home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
wtek0693.zip
/
OOPALLEY.ZIP
/
OOPSCONF.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-27
|
3KB
|
80 lines
#ifndef OOPSCONFIG_H
#define OOPSCONFIG_H
////////////////////////////////////////////////////////////
// Global inline functions
// (machine specific routines and information)
////////////////////////////////////////////////////////////
inline unsigned mod_sizeof_short(unsigned i)
{
return sizeof(short)&sizeof(short)-1
? i%sizeof(short)
: i&sizeof(short)-1;
}
inline unsigned mod_sizeof_int(unsigned i)
{
return sizeof(int)&sizeof(int)-1
? i%sizeof(int)
: i&sizeof(int)-1;
}
inline unsigned mod_sizeof_long(unsigned i)
{
return sizeof(long)&sizeof(long)-1
? i%sizeof(long)
: i&sizeof(long)-1;
}
inline unsigned mod_sizeof_float(unsigned i)
{
return sizeof(float)&sizeof(float)-1
? i%sizeof(float)
: i&sizeof(float)-1;
}
inline unsigned mod_sizeof_double(unsigned i)
{
return sizeof(double)&sizeof(double)-1
? i%sizeof(double)
: i&sizeof(double)-1;
}
inline unsigned mod_sizeof_ptr(unsigned i)
{
return sizeof(void*)&sizeof(void*)-1
? i%sizeof(void*)
: i&sizeof(void*)-1;
}
// These are machine specific
// and for the (8086) they are memory model specific
// This configuration is for a small memory model
inline unsigned div_bitsize_char(unsigned i) { return i >> 3; }
inline unsigned mod_bitsize_char(unsigned i) { return i & 7; }
inline unsigned div_sizeof_short(unsigned i) { return i >> 1; }
inline unsigned div_sizeof_int(unsigned i) { return i >> 1; }
inline unsigned div_sizeof_long(unsigned i) { return i >> 2; }
inline unsigned div_sizeof_float(unsigned i) { return i >> 2; }
inline unsigned div_sizeof_double(unsigned i) { return i >> 3; }
#ifdef __LARGE__
inline unsigned div_sizeof_ptr(unsigned i) { return i >> 2; }
#else
inline unsigned div_sizeof_ptr(unsigned i) { return i >> 1; }
#endif
////////////////////////////////////////////////////////////
// Pseudo-random number generator
////////////////////////////////////////////////////////////
const long MAX_INT = 0x7fffffffL;
//inline long DRAW(unsigned long& x) // Generates temporary variable
// for argument x Warning
inline long DRAW(unsigned long x) // 4/24/93 -gmv removed reference &
{ // to eliminate Warning
return (x = x*1103515245L + 12345) & MAX_INT;
}
#endif